{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-06-22T12:24:32.546284Z",
     "start_time": "2025-06-22T12:24:32.225924Z"
    }
   },
   "source": [
    "import pandas as pd"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "cell_type": "code",
   "id": "28b3bb0c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-22T12:24:36.695478Z",
     "start_time": "2025-06-22T12:24:36.692687Z"
    }
   },
   "source": [
    "import numpy as np"
   ],
   "outputs": [],
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "id": "4a054369",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-22T12:25:08.538205Z",
     "start_time": "2025-06-22T12:25:08.528566Z"
    }
   },
   "source": [
    "df = pd.DataFrame({\n",
    "    \"Group\": [f\"Group{i}\" for i in [1,2,3,4]*200],\n",
    "    \"X\": np.random.normal(0, 1, 800),\n",
    "    \"Y\": np.random.normal(0, 1, 800),\n",
    "})"
   ],
   "outputs": [],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-22T12:25:09.928665Z",
     "start_time": "2025-06-22T12:25:09.918920Z"
    }
   },
   "cell_type": "code",
   "source": "df",
   "id": "3228f26fa515a2d",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "      Group         X         Y\n",
       "0    Group1 -0.735529 -1.245258\n",
       "1    Group2 -0.188044 -0.216643\n",
       "2    Group3  0.168636  0.130265\n",
       "3    Group4  0.006903 -1.798520\n",
       "4    Group1 -0.377785 -1.213663\n",
       "..      ...       ...       ...\n",
       "795  Group4  0.284330 -0.411066\n",
       "796  Group1 -0.336891  1.200017\n",
       "797  Group2 -0.938799 -1.217465\n",
       "798  Group3 -0.300990 -0.745285\n",
       "799  Group4 -0.709189  0.736073\n",
       "\n",
       "[800 rows x 3 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Group</th>\n",
       "      <th>X</th>\n",
       "      <th>Y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Group1</td>\n",
       "      <td>-0.735529</td>\n",
       "      <td>-1.245258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Group2</td>\n",
       "      <td>-0.188044</td>\n",
       "      <td>-0.216643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Group3</td>\n",
       "      <td>0.168636</td>\n",
       "      <td>0.130265</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Group4</td>\n",
       "      <td>0.006903</td>\n",
       "      <td>-1.798520</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Group1</td>\n",
       "      <td>-0.377785</td>\n",
       "      <td>-1.213663</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>795</th>\n",
       "      <td>Group4</td>\n",
       "      <td>0.284330</td>\n",
       "      <td>-0.411066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>796</th>\n",
       "      <td>Group1</td>\n",
       "      <td>-0.336891</td>\n",
       "      <td>1.200017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>797</th>\n",
       "      <td>Group2</td>\n",
       "      <td>-0.938799</td>\n",
       "      <td>-1.217465</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>798</th>\n",
       "      <td>Group3</td>\n",
       "      <td>-0.300990</td>\n",
       "      <td>-0.745285</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>799</th>\n",
       "      <td>Group4</td>\n",
       "      <td>-0.709189</td>\n",
       "      <td>0.736073</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>800 rows × 3 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-22T12:28:12.799165Z",
     "start_time": "2025-06-22T12:28:12.751218Z"
    }
   },
   "cell_type": "code",
   "source": "df.to_excel(\"./example.xlsx\", header=True, index=False, engine=\"openpyxl\")",
   "id": "77199a598ca38b4e",
   "outputs": [],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-06-22T12:28:14.705108Z",
     "start_time": "2025-06-22T12:28:14.697035Z"
    }
   },
   "cell_type": "code",
   "source": "df.to_csv(\"./result.csv\", header=True, index=False, encoding=\"utf-8\")",
   "id": "3b168dfb0c02ec0e",
   "outputs": [],
   "execution_count": 12
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "e257ad7ba9ed97b9"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "notebooks",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
